package p270jp.pxv.android.viewholder;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.measurement.internal.C2066a;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.util.List;
import java.util.Objects;
import p045be.C1060c;
import p045be.View$OnClickListenerC1120z;
import p045be.View$OnLongClickListenerC1076i1;
import p090d0.C2518n;
import p134ei.AnalyticsScreenName;
import p159fi.FirebaseEventLogger;
import p165fo.C3114c;
import p183gh.ABTestService;
import p184gi.AnalyticsParameter;
import p184gi.FirebaseAnalyticsEventName;
import p270jp.pxv.android.R;
import p270jp.pxv.android.event.ShowWorkMenuOnLongClickEvent;
import p270jp.pxv.android.legacy.event.ShowNovelDetailDialogEvent;
import p270jp.pxv.android.legacy.event.ShowNovelTextEvent;
import p270jp.pxv.android.legacy.model.PixivNovel;
import p314lg.ViewNovelCarouselItemBinding;
import p325m0.C4721b;
import p350mp.Timber;
import p603wm.AbstractC6949c;

/* renamed from: jp.pxv.android.viewholder.NovelCarouselItemViewHolder */
/* loaded from: classes2.dex */
public class NovelCarouselItemViewHolder extends RecyclerView.AbstractC0819y {
    private ViewNovelCarouselItemBinding binding;
    private final AnalyticsScreenName screenName;
    private final AbstractC6949c<FirebaseEventLogger> firebaseEventLogger = C2518n.m7638h(FirebaseEventLogger.class);
    private final ABTestService abTestService = (ABTestService) C2518n.m7641d(ABTestService.class);

    public NovelCarouselItemViewHolder(ViewNovelCarouselItemBinding iaVar, AnalyticsScreenName cVar) {
        super(iaVar.f2666e);
        this.binding = iaVar;
        this.screenName = cVar;
    }

    public static NovelCarouselItemViewHolder createViewHolder(ViewGroup viewGroup, AnalyticsScreenName cVar) {
        return new NovelCarouselItemViewHolder((ViewNovelCarouselItemBinding) C1060c.m10358a(viewGroup, R.layout.view_novel_carousel_item, viewGroup, false), cVar);
    }

    /* renamed from: d */
    public static /* synthetic */ void m4417d(NovelCarouselItemViewHolder novelCarouselItemViewHolder, PixivNovel pixivNovel, View view) {
        novelCarouselItemViewHolder.lambda$bindViewHolder$0(pixivNovel, view);
    }

    public /* synthetic */ void lambda$bindViewHolder$0(PixivNovel pixivNovel, View view) {
        sendClickAnalyticsEvent(pixivNovel.f19079id);
        if (this.abTestService.m5838a()) {
            C3114c.m6284b().m6280f(new ShowNovelTextEvent(pixivNovel, null, this.screenName));
        } else {
            C3114c.m6284b().m6280f(new ShowNovelDetailDialogEvent(pixivNovel));
        }
    }

    public static /* synthetic */ boolean lambda$bindViewHolder$1(PixivNovel pixivNovel, View view) {
        C3114c.m6284b().m6280f(new ShowWorkMenuOnLongClickEvent(pixivNovel));
        return true;
    }

    private void sendClickAnalyticsEvent(long j) {
        FirebaseAnalyticsEventName jVar = FirebaseAnalyticsEventName.CLICK;
        FirebaseEventLogger value = this.firebaseEventLogger.getValue();
        C4721b.m3752b(1, "via");
        Bundle bundle = new Bundle();
        bundle.putString("click_name", "open_content");
        bundle.putString("screen_name", "HomeNovel");
        bundle.putString("item_id", String.valueOf(j));
        bundle.putString("via", C2066a.m8760a(1));
        value.m6296f();
        Timber.f23100a.mo3528a("%s %s", jVar, String.valueOf(bundle));
        FirebaseAnalytics firebaseAnalytics = value.f14642a;
        Objects.requireNonNull(jVar);
        firebaseAnalytics.f10008a.zzx("click", bundle);
    }

    public void bindViewHolder(List<PixivNovel> list, int i) {
        PixivNovel pixivNovel = list.get(i);
        this.binding.f21697q.setNovel(pixivNovel);
        this.binding.f21697q.setAnalyticsParameter(new AnalyticsParameter(this.screenName, null, 0));
        this.binding.f21697q.setOnClickListener(new View$OnClickListenerC1120z(this, pixivNovel, 4));
        this.binding.f21697q.setOnLongClickListener(new View$OnLongClickListenerC1076i1(pixivNovel, 1));
    }
}
